import request from '@/utils/request'

interface Section{
  title: string,  // 板块标题
  desc: number,   // 描述
  sort: number    // 排序
}

/**
 * 获取板块列表
 * @returns 
 */
export const listSection = () => {
  return request({
    method: 'get',
    url: '/section'
  })
}

/**
 * 添加板块列表
 * @returns 
 */
export const addSection = (data: Section) => {
  return request({
    method: 'post',
    url: '/section',
    data
  })
}

/**
 * 删除板块列表
 * @returns 
 */
export const delSection = (id: number|string) => {
  return request({
    method: 'delete',
    url: '/section/' + id,
  })
}

/**
 * 修改板块列表
 * @returns 
 */
export const updateSection = (data: Section) => {
  return request({
    method: 'put',
    url: '/section',
    data
  })
}

